home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form frmMainForm
- BackColor = &H0080FFFF&
- BorderStyle = 3 'Fixed Double
- Caption = "Network Diagramming"
- ClientHeight = 1905
- ClientLeft = 780
- ClientTop = 1800
- ClientWidth = 5115
- Height = 2595
- Icon = NETDIAG.FRX:0000
- Left = 720
- LinkTopic = "Form1"
- MaxButton = 0 'False
- ScaleHeight = 1905
- ScaleWidth = 5115
- Top = 1170
- Width = 5235
- Begin CommonDialog ctlCDialog
- Left = 480
- Top = 600
- End
- Begin Menu mnuFile
- Caption = "&File"
- Begin Menu mnuFileNewDBase
- Caption = "&New Database..."
- End
- Begin Menu mnuFileOpen
- Caption = "&Open Database..."
- End
- Begin Menu mnuFileSep1
- Caption = "-"
- End
- Begin Menu mnuFileExit
- Caption = "E&xit"
- End
- End
- '------------------------------------------------------------------------------
- '------------------------------------------------------------------------------
- '-- Network Diagramming Example
- '-- (C)1993 Shapeware Corporation
- '-- File Name : netdiag.frm
- '-- Description :
- '------------------------------------------------------------------------------
- '------------------------------------------------------------------------------
- 'This file contains sample code for using Visual Basic and OLE 2.0 to
- 'automatically create a Visio network diagram from a Microsoft Access
- 'database.
- 'IMPORTANT: NETVB.ZIP is ONLY a sample, not a released product. It was
- 'not extensively tested, and has no guarantee. In addition, we do not provide
- 'documentation or support for this file.
- 'After you download and unzip the file, read the file "abstract.wri" to get
- 'more information about what you need before running the file.
- 'To run the file*, open your Windows File Manager, go to the directory where
- 'you placed the unzipped files, and double-click the file "netdiag.mak." This
- 'will open Visual Basic. Press F5 to run the program. The program will run,
- 'and from its File menu, choose Open Database. Then choose "network.mdb"
- 'which is included in NETVB.ZIP and watch your blank Visio drawing page
- 'turn into a basic network diagram!
- '*It doesn't matter if you already have Visio running. If it is, that instance
- 'will be used. If not, the program will start it.
- Option Explicit
- Sub mnuFileExit_Click ()
- '----------------------------------------
- '--- mnuFileExit_Click ------------------
- '-- Handles request for exit. We prompt before exiting.
- Dim strMsg As String
- strMsg = "Are you sure you want to quit?"
- If MsgBox(strMsg, MB_ICONEXCLAMATION Or MB_YESNO, "Exit") = IDYES Then
- End
- End If
- End Sub
- Sub mnuFileNewDBase_Click ()
- '----------------------------------------
- '--- mnuFileNewDBase_Click --------------
- '-- Handles the user's request to build a blank database.
- On Error GoTo lblNewDBaseCatchCancelErr
- Dim strFileName As String
- ctlCDialog.DialogTitle = "Create Blank Database"
- ctlCDialog.CancelError = True
- ctlCDialog.Flags = OFN_HIDEREADONLY Or OFN_OVERWRITEPROMPT
- ctlCDialog.Filter = "Access Files (*.mdb)|*.mdb"
- ctlCDialog.DefaultExt = "mdb"
- ctlCDialog.Action = 2
- strFileName = ctlCDialog.Filename
- On Error GoTo lblKillCatch
- Kill strFileName
- SetMousePointer MP_WAIT
- CreateBlankDatabase strFileName
- SetMousePointer MP_NORMAL
- MsgBox strFileName & " Created.", MB_ICONINFORMATION, ""
- Exit Sub
- lblNewDBaseErr:
- MsgBox "Error creating blank database." & Chr(13) & Chr(10) & Error
- Exit Sub
- Resume Next
- lblNewDBaseCatchCancelErr:
- Exit Sub
- Resume Next
- lblKillCatch:
- Resume Next
- End Sub
- Sub mnuFileOpen_Click ()
- '----------------------------------------
- '--- mnuFileOpen_Click ------------------
- '-- The process for creating a network diagram requires we first prompt for
- '-- an Access database name. If the user selects a file we then verify it
- '-- is OK for diagramming (ValidDatabase) and if so we create the diagram.
- Dim strFileName As String
- On Error GoTo lblFileOpenErr
- ctlCDialog.DialogTitle = "Open Network Database"
- ctlCDialog.Filter = "Access Files (*.mdb)|*.mdb"
- ctlCDialog.CancelError = True
- ctlCDialog.Action = 1
- strFileName = ctlCDialog.Filename
- If ValidDatabase(strFileName) Then
- SetMousePointer MP_WAIT
- CreateDiagram (strFileName)
- SetMousePointer MP_NORMAL
- Else
- MsgBox "Invalid Database", MB_ICONEXCLAMATION, "Open"
- End If
- Exit Sub
- lblFileOpenErr:
- Exit Sub
- Resume Next
- End Sub
-